package client;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Rectangle;



public class Scoreboard{
	LocalPlayer player;
	private int x;
	private int y;
//	private String name;
//	private Color color;
//	private int victoryPoints;
//	private int grain;
//	private int ore;
//	private int wood;
//	private int brick;
//	private int cow;
//	private int roads;
//	private int houses;
//	private int cities;
//	private int cards;
//	private int armies;
//	private int LongRoad;
//	private boolean LRoad;
//	private boolean LArmy;
//	static final Color color1 = new Color(132,112,255);
//	static final Color color2 = new Color(32,210,170);
//	static final Color color3 = new Color(255,165,0);
//	static final Color color4 = new Color(255,105,180);
	public Scoreboard(int x, int y, LocalPlayer player){
		this.x = x;
		this.y = y;
		this.player = player;
	}
//	public void DefaultifyScoreBoard(){//test method
//		victoryPoints = 0;
//		grain = 0;
//		ore = 0;
//		wood = 0;
//		brick = 0;
//		cow = 0;
//		roads = 15;
//		houses = 5;
//		cities = 4;
//		cards = 0;
//		armies = 0;
//		LRoad = true;
//		LArmy = true;
//		isTurn= true;
//		
//	}
//	public void UpdateScoreBoard(int VP){ // used for imputs
//		this.victoryPoints = VP;
//	}
	public void PaintScoreBoard(Graphics2D g2){
		g2.setColor(Color.BLACK);
		g2.draw(new Rectangle(x,y,200,200));
		g2.setColor(player.getColor());
		g2.fill(new Rectangle(x,y,200,200));   //board
		g2.setColor(Color.WHITE);
		g2.fill(new Rectangle(x,y,200,20));
		g2.fill(new Rectangle(x + 69, y + 52, 20,14));//white backgrounds
		g2.fill(new Rectangle(x+155, y+66, 20, 14));
		g2.fill(new Rectangle(x+155, y+82, 20, 14));
		g2.fill(new Rectangle(x+155, y+98, 20, 14));
		g2.fill(new Rectangle(x+155, y+114, 20, 14));
		g2.fill(new Rectangle(x+155, y+130, 20, 14));
		g2.fill(new Rectangle(x+155, y+146, 20, 14));
		g2.fill(new Rectangle(x + 5, y + 35,20,14));
		g2.setColor(Color.black);
		g2.draw(new Rectangle(x,y,200,20));//name box
		g2.drawString(player.getName(), x + 5, y + 15);//name
		g2.drawString("Points", x + 5, y + 34);//points
		g2.draw(new Rectangle(x + 5, y + 35,20,14));//draw points		
		g2.drawString("Resources", x + 5, y + 64);//resources
		g2.draw(new Rectangle(x + 69, y + 52, 20,14));
		g2.drawString("Grain", x+10, y+79);
		g2.drawString("Ore", x+10, y+95);
		g2.drawString("Brick", x+10, y+111);
		g2.drawString("Cows", x+10, y+127);
		g2.drawString("Wood", x+10, y+143);
		g2.setColor(Color.YELLOW);				//grain
		g2.fill(new Rectangle(x+47, y+66, 20, 14));//resource boxes fill
		g2.setColor(Color.LIGHT_GRAY);			//ore
		g2.fill(new Rectangle(x+47, y+82, 20, 14));
		g2.setColor(new Color(255,0,0));		//brick
		g2.fill(new Rectangle(x+47, y+98, 20, 14));
		g2.setColor(new Color(124,252,0));		//cow
		g2.fill(new Rectangle(x+47, y+114, 20, 14));
		g2.setColor(new Color(205,133,63));		//Tree
		g2.fill(new Rectangle(x+47, y+130, 20, 14));
		g2.setColor(Color.BLACK);					//resource boxes border
		g2.draw(new Rectangle(x+47, y+66, 20, 14));
		g2.draw(new Rectangle(x+47, y+82, 20, 14));
		g2.draw(new Rectangle(x+47, y+98, 20, 14));
		g2.draw(new Rectangle(x+47, y+114, 20, 14));
		g2.draw(new Rectangle(x+47, y+130, 20, 14));
		g2.drawString("Buildings", x + 120, y+64); //buildings
		g2.drawString("Roads", x+110, y+79);
		g2.drawString("Houses", x+110, y+95);
		g2.drawString("Cities", x+110, y+111);
		g2.drawString("Cards", x+110, y+127);
		g2.drawString("Armies", x+110, y+143);
		g2.drawString("L.Road", x+110, y+159);
		g2.draw(new Rectangle(x+155, y+66, 20, 14));
		g2.draw(new Rectangle(x+155, y+82, 20, 14));
		g2.draw(new Rectangle(x+155, y+98, 20, 14));
		g2.draw(new Rectangle(x+155, y+114, 20, 14));
		g2.draw(new Rectangle(x+155, y+130, 20, 14));
		g2.draw(new Rectangle(x+155, y+146, 20, 14));
		if(player.hasLargestArmy())g2.drawString("L. Army", x + 70, y + 40);//road and army
		if(player.hasLongestRoad())g2.drawString("L. Road", x + 120, y + 40);
		g2.drawString(player.getVictoryPoints()+ "", x + 10, y + 47);//Resource #'s
		g2.drawString((player.totalResources()) + "", x + 74, y + 64);
		g2.drawString(player.amount(core.ResourceType.GRAIN) + "",x+52, y+78);
		g2.drawString(player.amount(core.ResourceType.ORE) + "",x+52, y+94);
		g2.drawString(player.amount(core.ResourceType.BRICK) + "",x+52, y+110);
		g2.drawString(player.amount(core.ResourceType.WOOL) + "",x+52, y+126);
		g2.drawString(player.amount(core.ResourceType.LUMBER) + "",x+52, y+142);
		g2.drawString(player.getRoadsLeft()+"", x+160, y+78);//building #'s
		g2.drawString(player.getHousesLeft()+"", x+160, y+94);
		g2.drawString(player.getCitiesLeft()+"", x+160, y+110);
		g2.drawString(player.getTotalCards()+"", x+160, y+126);
		g2.drawString(player.getArmies()+"", x+160, y+142);
		g2.drawString(player.getRoadLength()+"", x+160, y+158);
		if(player.isTurn()){
			g2.setColor(Color.red);
			g2.fill(new Rectangle(x+ 179, y+ 3, 16, 15));
			g2.setColor(Color.black);
			g2.fill(new Rectangle(x+ 184, y+ 7, 7,7));
			g2.draw(new Rectangle(x+ 179, y+ 3, 16,15));
			g2.setColor(Color.yellow);
			g2.fill(new Rectangle(186, y +9, 3, 3));
		}
		
		
	}
	
	
}
